<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const p1 = new Promise((reslove, reject)=>{
      reslove(1)
    })
    const p2 = new Promise((reslove, reject)=>{
      reject(2)
    })
    const p3 = new Promise((reslove, reject)=>{
      reslove(3)
    })

    
    // 不论Promise是成功还是失败都会收集allSettled
    Promise.allSettled([p1, p2, p3]).then(values=>{
      console.log(values);
    }).catch(err=>{
      console.log(err)
    })
    //  all 只要有一个promise崩掉, 就会直接进入catch
    Promise.all([p1, p2, p3]).then(values=>{
      console.log(values);
    }).catch(err=>{
      console.log(err)
    })
  </script>
</body>
</html>